<?php
class Parser_Html_Vimeo extends Parser_Html {
    
    public function need_redirect()
    {
        if (intval(Arr::get($this->_url_info, 'hash')) > 0)
        {
            return 'http://vimeo.com/'.intval(Arr::get($this->_url_info, 'hash'));
        }
        return FALSE;
    }
    
    
    public function author()
    {
        $author = $this->select('div.byline a');
        return isset($author[0]) ? Arr::get($author[0], 'text') : null;
    }
    
    
    public function content()
    {
        $id = intval(trim(Arr::get($this->_url_info, 'path'), '/'));
        if ($id > 0)
        {
            return 'http://player.vimeo.com/video/' . $id;
        }
    }
    
    public function type()
    {
        return $this->content() ? 'video' : 'link';
    }
    
}